<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class topuser extends CI_Controller {

	public function __construct() {
		parent::__construct();
		ini_set('session.cookie_httponly',1); 
		ini_set('session.use_only_cookies',1);	
		$this->load->model('topuser_class');
		$this->load->model('user_class');
	}	 
	public function list_topuser(){
		$data=array();
		
		$topuser = $this->topuser_class->list_topuser();
		if($topuser!=0){
			foreach($topuser as $key=>$value){
				$data['strUserName'][$key]='';
				$data['intID'][$key]=$value['intID'];
				$data['intUserID'][$key]=$value['intUserID'];
				$post['intUserID']=$value['intUserID'];
				$user = $this->user_class->get_user_data($post);
				if($user!=0){
					$data['strImgLink'][$key]=$user['strImgLink'];
					$data['strUserName'][$key]=$user['strName'];
				}							
				$data['intPoints'][$key]=$value['intPoints'];		
				//$data['intAvailablePoints'][$key]=1;//$value['intAvailablePoints'];		
				//$data['intCredits'][$key]=1;//$value['intCredits'];		
			}
		}
		echo json_encode($data);
	}
}